﻿    @(Html.X().Panel()
        .Region(Region.West)
        .Title("Modulos disponibles")
        .Layout(LayoutType.Fit)
        .Width(240)
        .Collapsible(true)
        .Split(true)
        .CollapseMode(CollapseMode.Header)
        .MarginSpec("0 0 4 4")
        .Border(false)
        .Items(items =>
        {
            items.Add(new TreePanel
            {
                ID = "modulosTree",
                AutoScroll = true,
                Lines = false,
                UseArrows = true,
                CollapseFirst = false,
                RootVisible = false,
                HideHeaders = true,
                Animate = false,
                Store =
                {
                    new TreeStore
                    {
                        Root = 
                        {
                            new Node
                            {
                                NodeID = "Root",
                                Expanded = true 
                            }
                        },
                        Proxy=
                        {
                            new AjaxProxy
                            {
                                API = 
                                {
                                    Read = Url.Action("GetModulos")
                                },
                                
                                ActionMethods=
                                {
                                    Read = HttpMethod.GET
                                }
                            }
                        }
                    }
                },

                ColumnModel =
                {
                    Columns = 
                    {
                        new TreeColumn
                        {
                            DataIndex = "text",
                            Flex = 1
                        }
                    }
                },

                Listeners =
                {
                    ItemClick =
                    {
                        Handler = "onTreeItemClick(record, e);"
                    }
                }
            });
        })
    )